package com.zhao.lazy;

/**
 * 懒汉式（线程不安全）
 * 优点：懒加载。
 * 缺点：线程不安全。
 */
public class LazyThreadUnsafe {
    //1.私有化构造方法
    private LazyThreadUnsafe() {

    }
    //2.声明静态变量
    private static LazyThreadUnsafe lazyThreadUnsafe;
    //3.提供获取实例的接口
    public static LazyThreadUnsafe getInstance() {
        if (lazyThreadUnsafe == null) {
            lazyThreadUnsafe = new LazyThreadUnsafe();
        }
        return lazyThreadUnsafe;
    }
}
